<!DOCTYPE html>
<meta charset="utf-8">
<title>document.open UseCounters with one argument</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<body>
<script>
const DocumentOpenTwoArgs = 2494; // From public/mojom/web_feature/web_feature.mojom
const DocumentOpenTwoArgsWithReplace = 2495; // From public/mojom/web_feature/web_feature.mojom
const DocumentOpenThreeArgs = 2496; // From public/mojom/web_feature/web_feature.mojom

test(() => {
  const frame = document.body.appendChild(document.createElement('iframe'));
  try {
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgs), "DocumentOpenTwoArgs: before");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgsWithReplace), "DocumentOpenTwoArgsWithReplace: before");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenThreeArgs), "DocumentOpenThreeArgs: before");
    frame.contentDocument.open('text/html');
    assert_true(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgs), "DocumentOpenTwoArgs: after");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenTwoArgsWithReplace), "DocumentOpenTwoArgsWithReplace: after");
    assert_false(internals.isUseCounted(frame.contentDocument, DocumentOpenThreeArgs), "DocumentOpenThreeArgs: after");
  } finally {
    frame.remove();
  }
}, 'document.open() with one argument');
</script>
</body>
